//============================================================================
// Name        : GSP295_Wk2_MergeSort.cpp
// Author      : Ronald Ram
// Version     :
// Copyright   : GSP295 Wk2 Program - MergeSort
// Description : Doubly Linked List, used to store string for Merge Sort in C++
//============================================================================

#ifndef DOUBLYLINKEDLIST_H_
#define DOUBLYLINKEDLIST_H_


#include <iostream>
#include <string>
using namespace std;


namespace GSP295_Wk2_MergeSort
{

enum Letter 
	{
		A=0, a=1, B=2, b=3, C=4, c=5, D=6, d=7, E=8, e=9, F=10, 
		f=11, G=12, g=13, H=14, h=15, I=16, i=17, J=18, j=19, K=20, 
		k=21, L=22, l=23, M=24, m=25, N=26, n=27, O=28, o=29, P=30, 
		p=31, Q=32, q=33, R=34, r=35, S=36, s=37, T=38, t=39, U=40, 
		u=41, V=42, v=43, W=44, w=45, X=46, x=47, Y=48, y=49, Z=50, 
		z=51
	};

	struct Node
	{
		char data;
		Node *prev, *next;
	};
	

	class DoublyLinkedList
	{
	private:
		Node *head, *last;
		int count;

		Node* copyList();
		Node* MergeSort(Node *list);
		Node* Merge( Node *left, Node *right);


	public:
		DoublyLinkedList ();			//C001: DEFAULT CONSTRUCTOR
		virtual ~DoublyLinkedList ();	//C002: DESTRUCTOR

		void Add(string input);			//M001: Add string to Linked List
		void Add(Node node);			//M002: Add Node to Linked List
		void MergeSort();				//M003: MergeSort Algorithm to sort the list alphabetically
		void Clear();					//M004: Delete all nodes in Linked List
		void Print();					//M005: Print all data in Linked List
		bool isEmpty() const;			//M006: T/F if Linked List is Empty
	};

}

#endif /* DOUBLYLINKEDLIST_H_ */
